using System;
using System.Xml.Serialization;

namespace DBProBridge
{
    /// <summary>
    /// Encapsulates options for the add-in.
    /// </summary>
    /// <remarks>That is the area to apply a lot of effort  according to what is targeted.
    /// Separate settings for editor, different sets for solutions and projects to watch and sync.
    /// Templates settings for new files.</remarks>
    /// <example><code>
    /// <![CDATA[
    /// //Property can be accessed through the object model with code such as the following macro:
    ///    Sub ToolsOptionsPageProperties()
    ///        MsgBox(DTE.Properties("My Category", "My Subcategory - Visual C#").Item("MyProperty").Value)
    ///        DTE.Properties("My Category", "My Subcategory - Visual C#").Item("MyProperty").Value = False
    ///        MsgBox(DTE.Properties("My Category", "My Subcategory - Visual C#").Item("MyProperty").Value)
    ///    End Sub]]>
    /// </code></example>
    [System.Runtime.InteropServices.ComVisible(true)]
    [System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDual)]
    [Serializable]
    [XmlRoot("DBProBridgeSettings")]
    public class Options
    {
        #region Fields

        string projectToWatch = @"[Enter path here].csproj";
        string projectToSync = @"[Enter path here].dbproj";
        string solutionToWatch = @"[Enter path here].Shadow.sln";
        string editor = "SqlWB.exe";
        string editorArguments = "-S [Enter db server path here] -nosplash -E \"$(FilePath)\"";
        private bool verboseLogging = false;

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets the project to watch.
        /// That is csproj for regular developers, dbproj for DBA.
        /// </summary>
        /// <value>The project to watch.</value>
        public string ProjectToWatch
        {
            get { return projectToWatch; }
            set { projectToWatch = value; }
        }

        /// <summary>
        /// Gets or sets the project to synchronize.
        /// That is dbproj for regular developers, csproj for DBA.
        /// </summary>
        /// <value>The project to sync.</value>
        public string ProjectToSync
        {
            get { return projectToSync; }
            set { projectToSync = value; }
        }


        /// <summary>
        /// Gets or sets the solution to watch.
        /// If open solution is not the one mathed by this value, 
        /// commands of an addin will not be executed.
        /// </summary>
        /// <value>The solution to watch.</value>
        public string SolutionToWatch
        {
            get { return solutionToWatch; }
            set { solutionToWatch = value; }
        }


        /// <summary>
        /// Gets or sets the editor to open on the open with Add-In command.
        /// </summary>
        /// <value>The editor.</value>
        public string Editor
        {
            get { return editor; }
            set { editor = value; }
        }


        /// <summary>
        /// Gets or sets the arguments to pass to the editor when it is invoked.
        /// </summary>
        /// <value>The editor arguments.</value>
        public string EditorArguments
        {
            get { return editorArguments; }
            set { editorArguments = value; }
        }

        /// <summary>
        /// Gets or sets a value indicating whether [verbose logging] should be used..
        /// </summary>
        /// <value><c>true</c> if [verbose logging]; otherwise, <c>false</c>.</value>
        public bool VerboseLogging
        {
            get { return verboseLogging; }
            set { verboseLogging = value; }
        }

        #endregion

        #region Public Methods

        /// <summary>
        /// Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
        /// </returns>
        public override string ToString()
        {
            return base.ToString() +
                "SolutionToWatch: " + SolutionToWatch + "\n" +
                "ProjectToWatch: " + ProjectToWatch + "\n" +
                "ProjectToSync: " + ProjectToSync;
        } 
        #endregion
    }
}
